If a row has content that is focus-on-click, and is set
to focus-on-click itself, then the row steals the focus
fromt he content, since it uses focus-on-click on button
release, as opposed to button press. Avoid that by
refusing to take focus if it is already on some
descendent of the row.
This was showing up in the widget-factory listbox on
page 2, where clicking on the spinbutton would briefly
put the focus on the spinbutton, only to lose it to
the row.
box->cursor_row = row;
ensure_row_visible (box, row);
if (grab_focus)
- gtk_widget_grab_focus (GTK_WIDGET (row));
+ {
+ GtkWidget *focus;
+
+ focus = gtk_root_get_focus (gtk_widget_get_root (GTK_WIDGET (box)));
+ if (!focus || !gtk_widget_is_ancestor (focus, GTK_WIDGET (row)))
+ gtk_widget_grab_focus (GTK_WIDGET (row));
+ }
gtk_widget_queue_draw (GTK_WIDGET (row));
_gtk_list_box_accessible_update_cursor (box, row);
}